﻿using _05.状态模式.Entities;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _05.状态模式
{
    /// <summary>
    /// 状态模式 - State Pattern
    /// 动机：对象状态的不同，行为也会不同
    /// 适用场景：项目状态为XX时不可XX，单据状态为XX时不可XX
    /// </summary>
    class Program
    {
        static void Main(string[] args)
        {
            DbContext dbSession = DbSession.CreateInstance();

            Project project = dbSession.Set<Project>().Single(x => x.ProjectName == "测试项目");
            project.Construct();


            dbSession.SaveChanges();

            Console.WriteLine("OK");
            Console.ReadKey();
        }
    }
}
